#ifndef _MZHTTP_H_
#define _MZHTTP_H_


#include <string>
#include <map>

// single arg
typedef struct _args{
	char key[255];
	char value[255];
	struct _args* next;       // chain(contain head pointer)
}mz_args;

// header dict e.g. Content-Type: xxxx ...
typedef struct _header_dict{
	std::string key;
	std::string value;
}mz_header_dict;

typedef std::map<std::string, std::string> MZ_HEADER_DICTMAP;

typedef struct _http_headers{
	char method[255];   // GET, POST ...
	char url[255];      //  /     /index.html      /login    ...
	char version[64];   // httpversion
	char* query_string;           // raw ?xxxxx string
	mz_args args;                 // chain of args
	MZ_HEADER_DICTMAP header_dict;       // dictionary of headers
} mz_http_headers;


mz_args* new_mz_args();
void delete_mz_args(mz_args* args);
// use key to get value
char* get_args_value(mz_args* args, const char* key);
// print
void print_args(mz_args* args);
void print_map(MZ_HEADER_DICTMAP* dict);

// format query_string into args
void format_args(char* query_string, mz_args* args);


// print the header details for debug
void show_headers(mz_http_headers* header);


#endif 
